{% extends 'django_ledger/layouts/content_layout_1.html' %}
{% load i18n %}
{% load static %}
{% load django_ledger %}

{% block aux_menu %}
    {% if unit_model and entity %}
        <div class="column is-12">{% period_navigation 'unit-cf' %}</div>
    {% elif entity %}
        <div class="column is-12">{% period_navigation 'entity-cf' %}</div>
    {% elif ledger %}
        <div class="column is-12">{% period_navigation 'ledger-cf' %}</div>
    {% elif unit_model %}
        <div class="column is-12">{% period_navigation 'unit-cf' %}</div>
    {% endif %}
{% endblock %}

{% block view_content %}
    <div class="card">
        <div class="card-content">
            <div class="container mb-4 has-text-centered">
                <div class="columns">
                    <div class="column">
                        {% if unit_model and entity %}
                            <h1 class="is-size-2 has-text-weight-light">{{ entity.name }}</h1>
                        {% elif entity %}
                            <h1 class="is-size-2 has-text-weight-light">{{ entity.name }}</h1>
                        {% elif ledger %}
                            <h1 class="is-size-2 has-text-weight-light">{{ ledger.name }}</h1>
                        {% endif %}
                        <h1 class="is-size-2 has-text-weight-bold">{% trans 'Cash Flow Statement' %}</h1>
                        {% if unit_model %}
                            <h3 class="is-size-4 has-text-weight-bold has-text-success">{{ unit_model.name }} {% trans 'Unit' %}</h3>
                        {% endif %}
                        <h2 class="is-size-2 has-text-weight-light">
                            {% if quarter %}{{ year }} | Q{{ quarter }}
                                {% elif month %}{{ start_date | date:'F, Y' }}
                                {% else %}{% trans 'Fiscal Year' %} {{ year }}
                            {% endif %}</h2>
                        <h3 class="is-size-4 is-italic has-font-weight-light">
                            {{ from_date | date:'m/d/Y' }} - {{ to_date | date:'m/d/Y' }}
                        </h3>
                    </div>
                </div>
            </div>

            {% cash_flow_statement io_model=object %}

            {% if entity %}
                <a class="button is-fullwidth is-dark is-small mb-1"
                   href="{% url 'django_ledger:ledger-list' entity_slug=view.kwargs.entity_slug %}">{% trans 'Go Back' %}</a>
            {% elif ledger %}
                <a class="button is-fullwidth is-dark is-small my-2"
                   href="{% url 'django_ledger:entity-dashboard' entity_slug=view.kwargs.entity_slug %}">{% trans 'Go Back' %}</a>
            {% endif %}
            <a class="button is-fullwidth is-light is-small my-2"
               href="?by_unit=1">{% trans 'By Unit' %}</a>

        </div>
    </div>
{% endblock %}
